import 'package:ati_package/core/extension/ati_widgets_extension.dart';
import 'package:ati_package/core/routes/app_routes.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:get/instance_manager.dart';

import '../../../core/utils/ati_assets.dart';
import '../../../core/utils/ati_color.dart';
import '../../../core/utils/ati_font.dart';

class UserMWidget extends StatelessWidget {
  const UserMWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return _buildMiddleWidget();
  }

  _buildMiddleWidget() {
    return Container(
      height: 100.r,
      margin: EdgeInsets.symmetric(horizontal: 16.r),
      padding: EdgeInsets.symmetric(horizontal: 20.r),

      alignment: Alignment.center,
      decoration: BoxDecoration(
        gradient: LinearGradient(
          colors: [Color(0xFF2750FE), Color(0xFF4BBFFE)],
        ),
        borderRadius: BorderRadius.circular(22.r),
      ),
      child: Row(
        children: [
          Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Row(
                children: [
                  Text(
                    '我的资产',
                    style: TextStyle(
                      color: AtiColor.textHLColor1,
                      fontSize: AtiFont.font14,
                      fontWeight: FontWeight.w600,
                    ),
                  ),
                  SizedBox(width: 10.r),
                  Image.asset(
                    width: 20.r,
                    height: 20.r,
                    AtiAssets.atiEyeOpent,
                    package: 'ati_package',
                  ),
                ],
              ),
              Text.rich(
                TextSpan(
                  children: [
                    TextSpan(
                      text: '23480.00',
                      style: TextStyle(
                        color: AtiColor.textHLColor1,
                        fontWeight: FontWeight.w700,
                        fontSize: 26.r,
                      ),
                    ),
                    TextSpan(
                      text: " USDT",
                      style: TextStyle(
                        color: Color(0xFFFAFAFE),
                        fontSize: AtiFont.font12,
                      ),
                    ),
                  ],
                ),
              ),
              Text(
                '相当于¥211,271,10 CNY',
                style: TextStyle(
                  color: AtiColor.textHLColor1,
                  fontSize: AtiFont.font12,
                  fontWeight: FontWeight.w500,
                ),
              ),
            ],
          ),
          Spacer(),
          Container(
            padding: EdgeInsets.symmetric(vertical: 5.r, horizontal: 15.r),
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.circular(20.r),
            ),
            child: Text(
              '账单',
              style: TextStyle(
                color: AtiColor.textColor1,
                fontSize: AtiFont.font12,
                fontWeight: FontWeight.w500,
              ),
            ),
          ).addTapGesture(
            onTap: () {
              Get.toNamed(AtiAppRoutes.userBillDet);
            },
          ),
        ],
      ),
    );
  }
}
